package wc.fileUtil;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;

import wc.fileUtil.exception.NoReadableFileException;

public class NewsFileReader extends FileReader {

	public NewsFileReader(String encode) throws NoReadableFileException {
		super(encode);
	}

	@Override
	public void parseFile(File file) throws NoReadableFileException {
		clear();
		if(file.isDirectory()) throw new NoReadableFileException();
        String s;
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), getEncode()));
            while((s = br.readLine()) != null) {
                addLine(s);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
	}

}
